[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
  Function            timetostr - convert time structure to a string

  Syntax              char *timetostr(struct time *tsource,
                                      boolean seconds, boolean hundreds,
                                      boolean ampm);

  Prototype in        timehk.h

  Remarks             timetostr converts a time structure to a string,
                      with the following options:

                           seconds   = put seconds in string
                           hundreds  = put hundreths of seconds in string
                           ampm      = append AM/PM to string

                      if ampm is FALSE, 24-hour time will be used.

                      if hundreds is TRUE, seconds are automatically put
                      into the string.

  Return value        returns a pointer to the storage location
                      containing the time string, or NULL if space could
                      not be allocated.

  See also            strtotime()

  Example             #include <timehk.h>

                      main()
                      {
                           char *strnow;
                           struct time now;

                           gettime(&now);
                           if ((strnow = timetostr(&now, FALSE, TRUE,
                                                   TRUE)) != NULL)
                                printf("The time is %s\n",strnow);
                      }

  Program output      The time is 11:23:14.22 PM


See Also: strtotime()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson